﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CaltechSoft.Service.EntityFW.Entity
{
    public class CertificateStandard : BaseEntity
    {
        [Key]
        public int CertificateStandardId { get; set; }

        public string StandardNo { get; set; }
        public string Manufacturer { get; set; }
        public string ModelNumber { get; set; }
        public string SerialNumber { get; set; }
        public DateTime DueDate { get; set; }
        public string TestReportNumber { get; set; }
        public string TechnicianName { get; set; }
        public string Description { get; set; }
        public IList<CertificateDetails> CertificateDetails { get; set; }
    }

    public class CertificateStandardMap : EntityTypeConfiguration<CertificateStandard>
    {
        public CertificateStandardMap()
        {
            this.HasKey(t => t.CertificateStandardId);
            this.Property(t => t.CertificateStandardId).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.ToTable("CertificateStandard");
            this.HasMany(x => x.CertificateDetails).WithRequired(x => x.CertificateStandard).HasForeignKey(x => x.CertificateStandardId);
        }
    }
}
